<?php
class Home extends CI_Controller
{
	private $data;
	function home()
	{
		parent::__construct();
		$this->layout->setLayout('layout');
		$this->load->library('session');
		$this->load->library('pagination');
		$this->load->model('project_model');
		$this->load->model('library_model');
		// $this->data['work_highlight'] = $this->work_highlight_model->getAll();
		// $this->data['product_highlight'] = $this->product_model->getListProduct();
	}
	function index()
	{
		$this->data['content'] = 'a';//$this->letter_model->getLetter(1);
		$this->layout->view('index',$this->data);
	}
	function introduce()
	{
		$this->data['content']=$this->introduce_model->getLetter(1);
		$this->layout->view('index',$this->data);
	}
	function specialized()
	{
		$this->data['content']=$this->specialized_model->getspecialized(1);
		$this->layout->view('index',$this->data);
	}
	function work()
	{
		$this->data['content']=$this->work_model->getWork(1);
		$this->layout->view('index',$this->data);
	}
	function partner()
	{
		$this->data['content']=$this->partner_model->getPartner(1);
		$this->layout->view('index',$this->data);
	}
	function contact()
	{
		$this->data['content']=$this->contact_model->getContact();
		//var_dump($this->data['content']);die;
		$this->layout->view('contactfrontend',$this->data);
	}
	function product()
	{

		$this->load->library('pagination');
		//paging
		$config['base_url'] =base_url()."index.php/home/product";
		$config['total_rows'] = $this->db->count_all('product');
		$config['per_page'] = '10';
		$config['uri_segment'] = 3;
		$this->pagination->initialize($config);
		//------------------
		$offset=$this->uri->segment(3);
		$product=$this->product_model->getAll($offset,$config['per_page']);
		$this->data['product']=$product->result();
		$this->layout->view('product',$this->data);
	}
	function detailproduct()
	{
		$id=$this->uri->segment(3);
		$this->data['product']=$product=$this->product_model->getProduct($id);
		//var_dump($data['detailproduct']);die;
		$this->layout->view('detailproduct',$this->data);
	}
	function workdetail()
	{
		$workId = $this->uri->segment(3);
		$this->data['work'] = $this->work_highlight_model->getById($workId);
		$this->layout->view('detailwork',$this->data);
	}
	function project()
	{
		$this->load->library('pagination');
		//paging
		$config['base_url'] =base_url()."index.php/home/project";
		$config['total_rows'] = $this->db->count_all('project');
		$config['per_page'] = '10';
		$config['uri_segment'] = 3;
		$this->pagination->initialize($config);
		//------------------
		$offset = $this->uri->segment(3);
		$this->data['project'] = $this->project_model->getListFProject($offset,$config['per_page']);
		$this->layout->view('listproject_fontend',$this->data);
	}
	function projectdetail()
	{
		$this->load->library('pagination');
		//paging
		$config['base_url'] =base_url()."index.php/home/project";
		$config['total_rows'] = $this->db->count_all('project');
		$config['per_page'] = '10';
		$config['uri_segment'] = 4;
		$this->pagination->initialize($config);
		//------------------
		$offset = $this->uri->segment(4);
		$projectId = $this->uri->segment(3);
		$this->data['project'] = $this->project_model->getProject($projectId);
		$this->data['library'] = $this->library_model->getListLibrary($offset,$config['per_page'],$projectId);
		$this->layout->view('slideshowlibrary',$this->data);
	}
	function video()
	{
		$this->load->library('pagination');
		//paging
		$config['base_url'] =base_url()."index.php/home/product";
		$config['total_rows'] = $this->db->count_all('video');
		$config['per_page'] = '10';
		$config['uri_segment'] = 3;
		$this->pagination->initialize($config); 
		//------------------
		$offset=$this->uri->segment(3);
		$this->data['video']=$this->video_model->getAll($offset,$config['per_page']);
		$this->layout->view('listfrontendvideo',$this->data);
	}
	function viewvideo()
	{
		$id=$this->uri->segment(3);
		$video=$this->video_model->getProduct($id);
		//var_dump($video);die;
		$this->data['video']=$video[0];
		$this->layout->view('viewvideo',$this->data);
	}
}
